package edu.kaist.cs442.client.android.common.pushutil.receive;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import edu.kaist.cs442.client.android.common.RestServices;
import edu.kaist.cs442.client.android.common.pushutil.register.TrackInstallation;

/**
 * Created with IntelliJ IDEA.
 * User: duyleekun
 * Date: 4/18/12
 * Time: 12:30 AM
 * To change this template use File | Settings | File Templates.
 */
public class C2DMRegistration extends BroadcastReceiver {
	@Override
	public void onReceive(Context context, Intent intent) {

		String registrationId = intent.getStringExtra("registration_id");
		String uuid = TrackInstallation.id(context);
		String newDevice = RestServices.getRegisterSVC().register(uuid,registrationId);

		Log.i("c2dm", "registration_id=" + registrationId);
		Log.i("c2dm", "UUID=" + uuid);
		Log.i("c2dm", "new_device=" + newDevice);
	}
}
